package org.vectrics.common.util;


import java.util.Properties;
import org.apache.log4j.Logger;


public class NullableProperties extends Properties {
	public static Logger log = Logger.getLogger(NullableProperties.class);


	public NullableProperties() {
		super();
	}

	public NullableProperties(Properties defaults) {
		super(defaults);
	}

	public Object setProperty(String name, String value) {
		if (value == null) {
			return(null);
		}
		else {
			return(super.setProperty(name, value));
		}
	}
	
	public String getPropertyString(String name) {
		log.info("getPropertyString() - called");
		
		String str = "";
		try {
			log.info("getPropertyString() - getting property");
			
			str = getProperty(name);
			if (str == null) {
				str = "";
			}
		}
		catch (Exception ex) {
			log.info("getPropertyString() - exception getting property");
			str = "";
		}
		
		return(str);
	}
}
